home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 May: Tool Chest / Developer CD Series Tool Chest (Apple Computer)(May 1999).iso / Tool Chest / Development Kits / MPW Related / MPW Script Tips 1.1.1 / Sample Makefiles / PSoundApp.make
Encoding:
Text File  |  1991-08-12  |  9.3 KB  |  239 lines  |  [TEXT/MPS ]

  1. # Note: This Makefile is included in the MPW package because it demonstrates many
  2. # of the features of Make.  
  3. #
  4. #
  5. # Apple Macintosh Developer Technical Support
  6. #
  7. # MultiFinder-Aware SoundApp Application
  8. #
  9. # SoundApp
  10. #
  11. # SoundApp.make    -    Make Source
  12. #
  13. # Copyright © 1989-1990 Apple Computer, Inc.
  14. # All rights reserved.
  15. #
  16. # Versions:
  17. #             1.03                    May, 1990
  18. #             1.04                    Sept, 1990
  19. #            1.1b1                    Nov, 1990        MPW 3.2 update
  20. #
  21. # Components:
  22. #             SoundApp.make        May 1, 1990            MPW build script
  23. #             SoundApp.p            May 1, 1990            Pascal source code
  24. #             SoundApp.r            May 1, 1990            Rez source code
  25. #             SoundAppSnds.r        May 1, 1990            Rez source code
  26. #             SoundUnit.p            May 1, 1990            Pascal source code
  27. #
  28. # Formatting was done with FONT = Monaco, SIZE = 9, TABS = 3
  29. #
  30. # SoundApp.p is a sample application source file for demonstrating
  31. # the Sound Manager.  It requires the use of the SoundUnit to handle
  32. # all of the sound routines.  This portion of the source code handles the
  33. # application’s management of memory, errors, user interface, etc..
  34. #
  35. # Jim Reekes E.O., Macintosh Developer Technical Support
  36. # Tuesday, January 30, 1990  1:01 PM
  37. #
  38.  
  39.  
  40.  
  41. AppName        =    PSoundApp
  42. Signature    =    'SAPP'
  43.  
  44. #------------------------------------------------------------------------------
  45. # Location of our utility files. The double “:” means “two levels above the
  46. # current folder”. Hopefully, this will also be the location of our
  47. # utilities folder. If not, then change the following line:
  48. #------------------------------------------------------------------------------
  49.  
  50. UtilityFolder = ::Utilities:
  51.  
  52.  
  53. #------------------------------------------------------------------------------
  54. # Options for our compilers:
  55. #    -sym on: tells the compilers and linker to emit symbol information for
  56. #        a source level debugger, such as SADE.
  57. #    -i {UtilityFolder}: means to look for any USES files in the specified
  58. #        directory, as well as the normal set.
  59. #    -mbg off: tells the compilers to not emit low-level debugger names. This
  60. #        saves on file space, but you may wish to remove this option if you
  61. #        need to debug with something like Macsbug.
  62. #    -rd: for Rez means to suppress warnings for redeclared types (we redeclare
  63. #        'RECT' because it’s not included in MPW 3.0).
  64. #    -append: means to add the resources to the target file, rather than
  65. #        deleting all the ones that are there first.
  66. #    -d Signature...: is a way of passing our application's signature to Rez.
  67. #        With this mechanism, we can define our signature here, and export
  68. #        it to Rez, so that we don't have to declare it there, too.
  69. #    -sn PASLIB=Main: puts all the routines that would normally go into the
  70. #        PASLIB segment into the Main segment. This is done so that when we
  71. #        call upon any low-level utilities, we don't potentially move memory
  72. #        by loading in a segment.
  73. #------------------------------------------------------------------------------
  74. # The Rez templates have changed from MPW 3.0/3.1 to MPW 3.2 (or will change,
  75. # depending on when you read this). Our .r file has conditional statements
  76. # that will cause the right things to happen. This is all controlled by the
  77. # dummy target ShellForce.
  78. #------------------------------------------------------------------------------
  79.  
  80. SymOptions        =     -sym off                    # turn this on to debug with SADE
  81. IncludesFolders    =    -i {UtilityFolder}
  82. AOptions        =    -d qDebug=0 {IncludesFolders}
  83. POptions        =    {IncludesFolders} {SymOptions} -mbg full
  84. RezOptions        =    -rd -append {IncludesFolders} -d Signature="{Signature}" -d AppName='{AppName}'
  85. LinkOptions        =    {SymOptions} {SegmentMappings}
  86. SegmentMappings    =    -sn INTENV=Main ∂
  87.                     -sn PASLIB=Main ∂
  88.                     -sn STDCLIB=Main ∂
  89.                     -sn SANELib=Main ∂
  90.                     -sn UtilMain=Main ∂
  91.                     -sn MAFailureRes=Main ∂
  92.                     -sn Offscreen=Main ∂
  93.                     -sn UtilInit=Initialization
  94.  
  95.  
  96. #------------------------------------------------------------------------------
  97. # These are modified default build rules.  This is necessary to take into
  98. # account differences between MPW 3.1 and 3.2
  99. #------------------------------------------------------------------------------
  100. .p.o            ƒ    .p
  101.     {Pascal} {POptions} {PAltOptions} {DepDir}{Default}.p -o {TargDir}{Default}.p.o
  102.  
  103. .c.o            ƒ    .c
  104.     {C} {COptions} {CAltOptions} {DepDir}{Default}.c -o {TargDir}{Default}.c.o
  105.  
  106. #------------------------------------------------------------------------------
  107. # These are the objects that we want to link with. If any one of these
  108. # changes, then we invoke the Link command.
  109. #------------------------------------------------------------------------------
  110.  
  111. AppObjects            =    ∂
  112.                     "{UtilityFolder}Utilities.p.o" ∂
  113.                     SoundUnit.p.o                ∂
  114.                     SoundApp.p.o
  115.                     
  116.                     
  117. #------------------------------------------------------------------------------
  118. # Which files we link with depends on whether we are running MPW 3.1 or 3.2
  119. # Under MPW 3.2 and later, “CInterface.o” and “CRuntime.o” are merged with 
  120. # “Interface.o” and “Runtime.o”. The appropriate choice will be made 
  121. # dynamically before compiling and linking occurs.  See ShellForce below.
  122. #
  123. # Be sure GestaltGlue.a.o is before Interface.o in PLibs and CLibs below.
  124. #------------------------------------------------------------------------------
  125. PLibs            =    ∂
  126.                     "{Libraries}Runtime.o" ∂
  127.                     "{UtilityFolder}"GestaltGlue.a.o ∂
  128.                     "{Libraries}Interface.o" ∂
  129.                     "{Libraries}"ToolLibs.o ∂
  130.                     "{PLibraries}"SANELib.o    ∂
  131.                     "{PLibraries}PasLib.o"
  132.  
  133. PLibs32            =    ∂
  134.                     "{Libraries}Runtime.o" ∂
  135.                     "{Libraries}Interface.o" ∂
  136.                     "{Libraries}"ToolLibs.o ∂
  137.                     "{PLibraries}"SANELib.o    ∂
  138.                     "{PLibraries}PasLib.o"
  139.  
  140. CLibs            =    ∂
  141.                     "{CLibraries}CRuntime.o" ∂
  142.                     "{CLibraries}CInterface.o" ∂
  143.                     "{Libraries}"ToolLibs.o ∂
  144.                     "{UtilityFolder}"GestaltGlue.a.o ∂
  145.                     "{Libraries}Interface.o"
  146.  
  147. CLibs32            =    ∂
  148.                     "{CLibraries}StdCLib.o" ∂
  149.                     "{Libraries}Runtime.o" ∂
  150.                     "{Libraries}"ToolLibs.o ∂
  151.                     "{Libraries}Interface.o"
  152.  
  153. #------------------------------------------------------------------------------
  154. # Generic Utilities dependencies - This standard set is pasted in whenever
  155. # we make use of the Utilities routines. It's quite probable that we don't
  156. # need all of these dependencies for this build, but any extra ones are
  157. # ignored.
  158. #------------------------------------------------------------------------------
  159.  
  160. UtilityRezFiles            =    {UtilityFolder}Utilities.r ∂
  161.                             {UtilityFolder}UtilitiesCommon.h
  162.                         
  163. UtilityHeaderFiles        =    {UtilityFolder}Utilities.h ∂
  164.                             {UtilityFolder}UtilitiesCommon.h
  165.  
  166. UtilityInterfaceFiles    =    {UtilityFolder}Utilities.p
  167.  
  168. {UtilityFolder}Utilities.p.o    ƒ    {UtilityFolder}Utilities.inc1.p
  169.  
  170. {UtilityFolder}Utilities.c.o    ƒ    {UtilityFolder}Utilities.h ∂
  171.                                     {UtilityFolder}UtilitiesCommon.h
  172.  
  173. #------------------------------------------------------------------------------
  174. # Dependencies for the individual components. These will invoke the
  175. # default build rules as described in Chapter 9 of the MPW 3.0 manual.
  176. #------------------------------------------------------------------------------
  177.  
  178. SoundApp.p.o        ƒ    {AppName}.make SoundUnit.p {UtilityInterfaceFiles}
  179.  
  180. SoundUnit.p.o        ƒ    {AppName}.make
  181.  
  182.  
  183. #------------------------------------------------------------------------------
  184. # This is a dummy dependency rule.  This will always be executed.  This dummy
  185. # rule must be the first for {AppName} so that it will be executed first.
  186. # This is necessary to make evaluations that are beyond the scope of
  187. # Make.  These evaluations will be performed by the Shell at execution time,
  188. # and they must execute first because compile and link command lines depend
  189. # on variables set up by these evaluations.  This has the unfortunate side
  190. # effect that Make will always consider {AppName} to be out of date.  It will
  191. # always, at a minimum, execute the commands for the target ShellForce.
  192. #------------------------------------------------------------------------------
  193.  
  194. {AppName}            ƒƒ ShellForce
  195.  
  196. # With the above rule, {AppName} will always be out of date with respect to
  197. # the non-existent file ShellForce.  This will force the following commands to
  198. # be executed.
  199. ShellForce            ƒ
  200.     BEGIN
  201.         IF "{ShellVersion}" == ""
  202.             ( EVALUATE "`Version`" =~ /MPW Shell≈ ([0-9]+(.[ab0-9]+)+)®1≈/ ) ∑ Dev:Null
  203.             SET ShellVersion "{®1}"
  204.         END
  205.         IF "{ShellVersion}" =~ /3.[01]≈/
  206.             SET PAltOptions        "-d MPW32=FALSE"
  207.             SET CAltOptions        "-d MPW31"
  208.             SET RezAltOptions    "-d MPW31"
  209.             SET PSysObjects        "`QUOTE {PLibs}`"
  210.             SET CSysObjects        "`QUOTE {CLibs}`"
  211.         ELSE
  212.             SET PAltOptions        "-d MPW32=TRUE"
  213.             SET CAltOptions        "-d MPW32"
  214.             SET RezAltOptions    "-d MPW32"
  215.             SET PSysObjects        "`QUOTE {PLibs32}`"
  216.             SET CSysObjects        "`QUOTE {CLibs32}`"
  217.         END
  218.     END ∑ Dev:Null # Output to bit bucket so we don’t see above calculations
  219.  
  220. #------------------------------------------------------------------------------
  221. # Build rule that links our application together. If any of our objects 
  222. # changes, or this makefile changes, then we relink.
  223. #------------------------------------------------------------------------------
  224.  
  225. {AppName}            ƒƒ {AppObjects}
  226.     Link {LinkOptions} -o {Targ} {AppObjects} {PSysObjects}
  227.     SetFile {Targ} -t APPL -c {Signature} -a B
  228.  
  229. #------------------------------------------------------------------------------
  230. # Build rule that creates our resources and adds them to the application
  231. #------------------------------------------------------------------------------
  232.  
  233. {AppName}            ƒƒ SoundAppSnds.r {AppName}.make
  234.     Rez {RezOptions} {RezAltOptions} -o {Targ} SoundAppSnds.r
  235.  
  236. {AppName}            ƒƒ SoundApp.r {AppName}.make
  237.     Rez {RezOptions} {RezAltOptions} -o {Targ} SoundApp.r
  238.  
  239.